home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / checkIPServer / fixIPServer.old < prev    next >
Encoding:
Text File  |  1990-11-09  |  922 b   |  32 lines

  1. #!/bin/csh -f
  2. #
  3. # Script to check up on a host's ipServer, and restart it if needed
  4. #
  5. set pid=`ps -ad | egrep ipServer | awk '{print $1}'`
  6. if (X$pid == "X") then
  7. # see if it went away completely.
  8.     set pid=`ps -a | egrep ipServer | sed '/egrep/d' | awk '{print $1}'`
  9.     if (X$pid != "X") then
  10.         exit
  11.     endif
  12. endif
  13.  
  14. set host=`hostname`
  15.  
  16. echo "IPSERVER found DEAD at `date`" > /dev/syslog
  17. set clients=`ps | egrep 'nfsmount|portmap|unfsd|sendmail|inetd|bootp|lpd' | sed '/egrep/d' | awk '{print $1}'`
  18. echo "Killing ipServer $pid and clients $clients" > /dev/syslog
  19. kill -KILL $clients
  20. kill -KILL $pid
  21.  
  22. echo "Restarting ipServer and its clients" > /dev/syslog
  23. if (-e /hosts/$host/restartservers) then
  24.     /hosts/$host/restartservers >& /dev/syslog
  25. else
  26.     /sprite/admin/scripts/startClientServers >& /dev/syslog
  27. endif
  28.  
  29. if ($#argv > 0) then
  30.     echo "IPServer on $host died and was restarted" | mail spriters
  31. endif
  32.